package com.wzdigit.wms.wms.controller.common;

import com.wzdigit.framework.exception.RestStatusException;
import com.wzdigit.wms.basic.enums.writeback.BackResultEnum;
import com.wzdigit.wms.wms.constant.WmsWareConstant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Slf4j
@RestController
@Api(tags = "数据回传相关参数枚举控制层")
@RequestMapping(value = WmsWareConstant.API_VERSION)
public class IfPostbackEnumController {

    public static final String REQUSET_MODEL = "/sys/common/ifpostbackEnum";


    @ApiOperation(value = "数据回传表-回传结果", notes = "数据回传表-回传结果")
    @GetMapping(value = REQUSET_MODEL + "/getBackResultEnums")
    public BackResultEnum[] getBackResultEnums(
            HttpServletRequest servletRequest,
            HttpServletResponse servletResponse) {
        try {
            return BackResultEnum.values();
        } catch (RestStatusException ex) {
            servletResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
            throw ex;
        }
    }
}
